Skip to content

Conversation

JhanBoChao-Realtek
Copy link
Contributor

The rts5912's port 80 has a FIFO. In the ISR (Interrupt Service Routine), extract the FIFO data until the FIFO is empty, otherwise port 80 data will be lost.

Copy link

espi_send_callbacks(&espi_data->callbacks, dev, evt);
int32_t start_time = k_uptime_get_32();

while (!(port80_reg->STS & PORT80_STS_FIFOEM)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As implemented, you are including the time spent in the callback as part of the timeout check. If the callback is slow, this will cause a false timeout. You should exclude the callback time in this calculation.

Also note that it's recommended to use the 64-bit version of k_uptime_get()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. This timeout is designed to prevent the EC from spending excessive time stuck in the ISR. However, it is difficult to reasonably estimate the time required for the callback. Actual testing shows that under normal conditions, the EC retrieves 1 to 3 entries from the FIFO. Even with frequent writes from the host, the maximum count of 16 entries should be sufficient. Therefore, a usage count limit replaces the original time limit.

The rts5912's port 80 has a FIFO. In the ISR (Interrupt Service Routine),
extract the FIFO data until the FIFO is empty, otherwise port 80 data will
be lost.

Signed-off-by: jhan bo chao <[email protected]>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants